package com.centaline.androidsalesblog.api.newest;

import com.baidu.mapapi.model.LatLng;
import com.centaline.androidsalesblog.api.NewEstApi;
import com.centaline.androidsalesblog.model.responseobject.NewEstListRo;
import com.centanet.framework.interfaces.IResponseListener;

/**
 * 新盘地图搜索
 * Created by guilin on 16/2/23.
 */
public class NewEstMapSearchApi extends NewEstApi<NewEstListRo> {

    private int startIndex;
    private int length = 10;
    private String title;
    private String distance;
    private LatLng latLng;
    private String districtId;
    private String gScopeId;
    private String estType;
    private String minAveragePrice;
    private String maxAveragePrice;
    private String roomCnt;
    private String gtRoomCnt;
    private String tags;
    private String opDateBegin;
    private String opDateEnd;
    private String sortBy;
    private int usedEstExtIds;
    private String estExtIds;

    public NewEstMapSearchApi(Class<?> tag, Class<NewEstListRo> aClass, IResponseListener<NewEstListRo> iResponseListener) {
        super(tag, aClass, iResponseListener);
    }

    public void setStartIndex(int startIndex) {
        this.startIndex = startIndex;
    }

    public int getStartIndex() {
        return startIndex;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void setLatLng(LatLng latLng) {
        this.latLng = latLng;
    }

    public void setDistance(String distance) {
        this.distance = distance;
    }

    public void setDistrictId(String districtId) {
        this.districtId = districtId;
    }

    public void setgScopeId(String gScopeId) {
        this.gScopeId = gScopeId;
    }

    public void setEstType(String estType) {
        this.estType = estType;
    }

    public void setMinAveragePrice(String minAveragePrice) {
        this.minAveragePrice = minAveragePrice;
    }

    public void setMaxAveragePrice(String maxAveragePrice) {
        this.maxAveragePrice = maxAveragePrice;
    }

    public void setRoomCnt(String roomCnt) {
        this.roomCnt = roomCnt;
    }

    public void setGtRoomCnt(String gtRoomCnt) {
        this.gtRoomCnt = gtRoomCnt;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public void setOpDateBegin(String opDateBegin) {
        this.opDateBegin = opDateBegin;
    }

    public void setOpDateEnd(String opDateEnd) {
        this.opDateEnd = opDateEnd;
    }

    public void setSortBy(String sortBy) {
        this.sortBy = sortBy;
    }

    public void setUsedEstExtIds(int usedEstExtIds) {
        this.usedEstExtIds = usedEstExtIds;
    }

    public void setEstExtIds(String estExtIds) {
        this.estExtIds = estExtIds;
    }

    public void reset() {
        districtId = "";
        gScopeId = "";
        distance = "";
        latLng = null;
    }

    public void resetOther() {
        sortBy = "";
        roomCnt = "";
        gtRoomCnt = "";
        opDateBegin = "";
        opDateEnd = "";
    }

    @Override
    protected void setParams() {
        resetParams();
        putParams("startIndex", startIndex);
        putParams("length", length);
        putStringParams("title", title);
        putStringParams("districtId", districtId);
        putStringParams("gScopeId", gScopeId);
        putStringParams("estType", estType);
        putStringParams("minAveragePrice", minAveragePrice);
        putStringParams("maxAveragePrice", maxAveragePrice);
        putStringParams("RoomCnt", roomCnt);
        putStringParams("GtRoomCnt", gtRoomCnt);
        putStringParams("OpDateBegin", opDateBegin);
        putStringParams("OpDateEnd", opDateEnd);
        putStringParams("SortBy", sortBy);
        putStringParams("Tags", tags);
        if (latLng != null) {
            putParams("lat", latLng.latitude);
            putParams("lng", latLng.longitude);
            putStringParams("distance", distance);
        }
        if (usedEstExtIds == 1) {
            putParams("UsedEstExtIds", 1);
            putParams("EstExtIds", estExtIds);
        }
    }

    @Override
    protected String getPath() {
        return "NewPropExtInfoMapSearchRequest";
    }
}
